﻿using System;
using System.Collections.Generic;

namespace Sustainalytics.ESGRatings.BusinessLogic.Tests.FocusedRatings
{
    using System.Collections.Concurrent;
    using Sustainalytics.Synchronization.Interface;

    using Xunit;
    using Xunit.Abstractions;

    public class ESGRatingsWeightMatrixSyncStepTest
    {
        private readonly ITestOutputHelper helper;

        private readonly SyncContext context;

        public ESGRatingsWeightMatrixSyncStepTest(ITestOutputHelper helper)
        {
            this.helper = helper;
            var warehouseConnectionString = "mongodb://sustadmin:G4nd4lf2014@54.171.12.91:27017/ClientDW_A";

            this.context = new SyncContext
            {
                GAConnectionStrings = new Dictionary<string, string>(),
                CompanyUniverses = new Dictionary<Guid, List<int>>(),
                PreviousChanges = new List<ChangedElement>(),
                Report = new ConcurrentBag<string>()
            };
            this.context.GAConnectionStrings["ClientPlatform"] = "mongodb://54.171.12.91:27017/ClientPlatform";
            this.context.GAConnectionStrings["ClientDW"] = warehouseConnectionString;
        }

        [Fact]
        public void ESGRatingsWeightMatrixSyncStepRun()
        {
            var sut = new ESGRatingsCompanyWeightsSyncStep();
            try
            {
                sut.Start(this.context);
            }
            catch (Exception exception)
            {
                this.helper.WriteLine(exception.StackTrace);
                this.helper.WriteLine(exception.Message);
            }
        }
    }
}